
@echo off & setlocal EnableDelayedExpansion
echo Run StartService.bat
echo open url in browser : http://127.0.0.1:8015/docs
title UITool-FastApi

echo ping 1.1.1.1 -n 1 -w 3000 > nul

set obj[0]=8015
set port=0
set pid=0

for /f "usebackq delims== tokens=1-2" %%a in (`set obj`) do (
    set port=%%b
    for /f "tokens=5" %%m in ('netstat -aon ^| findstr ":%%b"') do (
        set pid=%%m
    )
    if "!pid!"=="0" (
        echo port [!port!] free!
    ) else (
        echo prot [!port!] killed!
        taskkill /pid !pid! /f /t
		taskkill /f /FI "UITool-FastApi"
    )
    set pid=0
)


C:\\qturbo-python\\Python36-32\\python.exe -i ./app_fast.py

echo start working
echo open url in browser : http://127.0.0.1:8015/docs
exist